﻿using Hicap.QRCodeWarehouse.Core.Common;

namespace Hicap.QRCodeWarehouse.Core.Identity
{
    public class AuthObjectHelper
    {
        public static string ConvertActionNameToAuthObject(string actionName)
        {
            if (actionName.Contains(ActionEnum.Delete.ToString())) return ActionEnum.Delete.ToString();
            if (actionName.Contains(ActionEnum.Restore.ToString())) return ActionEnum.Delete.ToString();
            if (actionName.Contains(ActionEnum.Insert.ToString())) return ActionEnum.Upsert.ToString();
            if (actionName.Contains(ActionEnum.Upsert.ToString())) return ActionEnum.Upsert.ToString();
            if (actionName.Contains(ActionEnum.Update.ToString())) return ActionEnum.Upsert.ToString();
            if (actionName.Contains(ActionEnum.Make.ToString())) return ActionEnum.Upsert.ToString();
            if (actionName.Contains(ActionEnum.Import.ToString())) return ActionEnum.Upsert.ToString();
            if (actionName.Contains(ActionEnum.Download.ToString())) return ActionEnum.Download.ToString();
            if (actionName.Contains(ActionEnum.Upload.ToString())) return ActionEnum.Upload.ToString();

            return string.Empty;
        }
    }
}